package sk.tuke.persistance;

import java.io.Serializable;
import javax.persistence.*;

@Entity
@org.hibernate.annotations.Proxy(lazy = false)
@Table(name = "PATIENT")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorValue("PATIENT")
public class PatientPo extends UserPo implements Serializable {

	private static final long serialVersionUID = 1L;

	public PatientPo() {
	}

	@OneToOne
	private HealthCardPo healthCard;

	@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "patients", targetEntity = DoctorPo.class)
	private java.util.Set<DoctorPo> doctors = new java.util.HashSet<DoctorPo>();

	public void setDoctors(java.util.Set<DoctorPo> value) {
		this.doctors = value;
	}

	public java.util.Set<DoctorPo> getDoctors() {
		return doctors;
	}

	public void setHealthCard(HealthCardPo value) {
		this.healthCard = value;
	}

	public HealthCardPo getHealthCard() {
		return healthCard;
	}

	public String toString() {
		return super.toString();
	}

	public boolean equals(Object aObj) {
		if (aObj == this)
			return true;
		if (!(aObj instanceof PatientPo))
			return false;
		PatientPo patient = (PatientPo) aObj;
		if (getId() != patient.getId())
			return false;
		return true;
	}

	public int hashCode() {
		int hashcode = 0;
		hashcode = hashcode + (int) getId();
		return hashcode;
	}

}
